<template>
    <div>
       <HelloWorld @rong="neirong" @kan="zhuang" @xiang="fan"/>
    <ul v-for="(item,index) in arr" :key="index">
      <li><span>{{ item.xi }}</span><br>
        <span>{{ item.tai }}</span><button @click="shan(item.id)">删除</button></li>
    
    </ul>
    </div>
</template>
<script>
  import HelloWorld from '@/components/HelloWorld.vue'
// import HelloWorld from '@/components/HelloWorld.vue'
  export default{
   components:{
    HelloWorld
   },
    data(){
       return{
            arr:[],
            // b:'',
          //  name:MessCom
        }
    },
    methods:{
       neirong(res){
        return this.arr.push({
          id: this.arr.length,
          tai:res,
          xi:this.b
        })
        
       },
       zhuang(res){
        return this.b=res
       },
       fan(res){
        return this.b=res
       },
       shan(i){
          var f = this.arr.findIndex(item => item.chengji >= i)
                this.arr.splice(f,1)
       }
    }
  }
</script>